
#ifndef _API_COM_H_
#define _API_COM_H_


/*********************************************************************************************************
**                                          MACRO DEF
*********************************************************************************************************/
#define	 IOT_TIMER_1_TICK					1	//(4.615ms)
#define  IOT_TIMER_9MS                      2
#define  IOT_TIMER_20MS                     4
#define  IOT_TIMER_50MS                     10
#define  IOT_TIMER_100MS                    21
#define  IOT_TIMER_200MS                    42
#define  IOT_TIMER_400MS                    84
#define  IOT_TIMER_500MS                    108
#define  IOT_TIMER_1S                       216
#define  IOT_TIMER_3S                       (IOT_TIMER_1S *3)
#define  IOT_TIMER_5S                       (IOT_TIMER_1S * 5)
#define  IOT_TIMER_10S                      (IOT_TIMER_1S * 10)
#define  IOT_TIMER_15S                      (IOT_TIMER_1S * 15)
#define  IOT_TIMER_20S                      (IOT_TIMER_1S * 20)
#define  IOT_TIMER_30S                      (IOT_TIMER_1S * 30)
#define  IOT_TIMER_40S                      (IOT_TIMER_1S * 40)
#define  IOT_TIMER_60S                      (IOT_TIMER_1S * 60)
#define  IOT_TIMER_100S                     (IOT_TIMER_1S * 100)
#define  IOT_TIMER_120S                     (IOT_TIMER_1S * 120)

#define  TIME_1S_IN_9MS						

#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) > (b) ? (b) : (a))

#define MAX_CNT_CONST	0xffffffff

#define YEAR_START              2000
/*********************************************************************************************************
**                                          ENUM&STRUCT
*********************************************************************************************************/

/*********************************************************************************************************
**                                          GLOBAL VAR
*********************************************************************************************************/

/*********************************************************************************************************
**                                          LOCAL VAR
*********************************************************************************************************/

/*********************************************************************************************************
**                                          FUNCTIONS
*********************************************************************************************************/
extern void Iot_DelayMs(U32 ms);

extern void com_sysTimeWrite(void);
extern U32  com_sysTimeRead(void);

extern U32	com_String2HexArray(U8 *str, U8 *hex , U32 str_len);
extern U32	com_HexArray2String(U8 *hex, U8 *str , U32 hex_len);	

extern void	com_U16ToU8Array(U16 src, U8 *des);
extern U16	com_U8ArrayToU16(U8 *src);
extern void	com_U32ToU8Array(U32 src, U8 *des);
extern U32	com_U8ArrayToU32(U8 *src);

BOOL com_IsStrAInStrB(U8 *strB, U8 *strA, U16 strBlen, U16 strAlen, U16*currentpos);
void com_Dec2CompressHex(U8 buf[], U32 n);
void com_Dec2CompressHexByte(U8 *after, U8 before);
void com_DegreePoint2DegreeFormat(U32 *outformat, U32 informat);
void com_compresshex2str(U8 hex[], U8 *str);

void com_TimeAdjust(iot_S_Rtc *time, S16 timezone, BOOL daylightsavingtime);
#endif
/*********************************************************************************************************
End Of File
*********************************************************************************************************/





